<template>
	<public-view navType="other" navTitle="钱包">
		<view class="content">
			<view class="w-100 money-view">
				<view class="my-money-box" >
					<view class="itme flex a-i-c j-c-b">
						<view class="f-s-44 color-fff f-w-b title flex a-i-c">
							钱包 
							<view class="rechange-box f-s-20 color-fff all-center" @click="goTo({url:'/pages/my/rechangeMoney'})">
								充值
							</view>
						</view>
						<image class="next-page-icon" src="@/static/images/my/white-next.svg" mode=""></image>
					</view>
					<view class="itme flex a-i-c j-c-b" @click="goTo({url:'/pages/my/rechangeLog'})">
						<view class="color-fff80 f-s-24">
							账户余额(元)
						</view>
						<view class="money-right flex a-i-c">
							<view class="f-s-36 color-fff f-w-b">
								<block v-if="!hide_money">
									{{user.money || 0}}
								</block>
								<block v-else>
									**********
								</block>
							</view>
							<image @click.stop="hide_money=!hide_money" class="next-page-icon mar-12" :src="`/static/images/my/${hide_money?'close-eyes':'eyes-money'}.svg`" mode=""></image>
						</view>
					</view>
				</view>
			</view>
			<view class="tixian-box">
				<view class="title color-3c3c3c f-s-28">
					可提现余额
				</view>
				<view class="rechange-money-box w-100 flex a-i-c j-c-b">
					<view class="left f-s-48 f-w-b">
						￥{{user.money||0}}
					</view>
					<view class="right flex a-i-c color-2567F3 f-s-26" @click="goTo({url:'/pages/my/withdrawal?type=user'})">
						<image class="tixian-icon" src="@/static/images/my/rechange.svg" mode=""></image>
						去提现
					</view>
				</view>
			</view>
			<view class="log-list">
				<block v-for="(item, index) in log_list" :key="index">
					<view class="item flex j-c-b a-i-c">
						<view class="left">
							<view class="subtitle f-s-28">
								{{item.memo||""}}
							</view>
							<view class="time color-878787 f-s-24">
								到账时间：{{item.createtime||""}}
							</view>
						</view>
						<!-- color-F8A039 -->
						<view class="right color-ff4545 f-s-48 f-w-b">
							{{item.money||""}}
						</view>
					</view>
				</block>
			</view>
		</view>
	</public-view>
</template>

<script>
	import {goTo} from "@/nav.js"
	export default {
		data() {
			return {
				page: 1,
				user:{},
				log_list:[],
				hide_money:true
			};
		},
		onLoad() {
			this.user = uni.getStorageSync("userInfo")
		},
		onShow() {
			this.getMoneyLog()
		},
		methods:{
			goTo,
			getMoneyLog(){
				let that = this
				that.util.postRequest({
					url:"v1/user/getMoneylog",
					data:{
						page:that.page,
						rows:10
					}
				}).then(res=>{
					// console.log(res)
					if(that.page === 1){
						that.log_list = res.data.data
					}else{
						if(res.data.data.length>0){
							that.log_list = that.log_list.concat(res.data.data)
						}else{
							that.page--
						}
					}
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.log-list{
		width: 100%;
		padding: 0 40upx;
		.item{
			width: 100%;
			background: #FFFFFF;
			border-radius: 16upx;
			margin-bottom: 20upx;
			padding: 36upx;
			.left{
				.subtitle{
					line-height: 40upx;
					margin-bottom: 30upx;
				}
			}
		}
	}
	.tixian-box{
		width: 100%;
		padding: 0 52upx;
		margin-bottom: 28upx;
		.rechange-money-box{
			.left{
				color: #F32E2E;
				line-height: 68upx;
			}
			.right{
				.tixian-icon{
					width: 40upx;
					height: 40upx;
					margin-right: 16upx;
				}
			}
		}
		.title{
			line-height: 40upx;
		}
	}
	.next-page-icon{
		width: 32upx;
		height: 32upx;
	}
	.money-view{
		padding: 0 28upx;
	}
	.my-money-box{
		background-image: url("@/static/images/my/my-money-svg.svg");
		background-size: 100% 100%;
		width: 100%;
		height: 172upx;
		margin-bottom: 34upx;
		.itme{
			height: 50%;
			width: 100%;
			padding: 0 32upx;
			.white-next{
				
			}
			.title{
				font-family: 'PangMenZhengDao-3';
				font-style: normal;
				.rechange-box{
					border: 2upx solid #FFFFFF;
					border-radius: 50upx;
					width: 56upx;
					height: 32upx;
					margin-left: 24upx;
				}
			}
			.money-right{
				.mar-12{
					margin-right: 12upx;
				}
			}
		}
	}
	.content{
		width: 750upx;
		padding: 34upx 0;
	}
</style>
